<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第二个问题</title>
    <style>
        .analog {
            width: 200px;
            height: 50px;
            background-color: red;
        }
    </style>
</head>

<body>
    <div id="anone"></div>
</body>

</html>
<script>
    var data={
        name:"ABC",
        width:'100'
    }
    var contentDiv=document.getElementById('anone')
    var anoneDiv=document.createElement('div')
    anoneDiv.className="analog" //添加样式
    anoneDiv.style.width=data.width+'px' //添加样式
    anoneDiv.innerText =data.name //添加样式
     //变量位置
     anoneDiv.style.position="absolute" //添加样式
     anoneDiv.style.top="300"+'px'  //添加样式
     anoneDiv.style.left="100"+'px' //添加样式

     //插入
     contentDiv.appendChild(anoneDiv)
</script>